package com.tjc.common.pool;

import java.io.Closeable;
import java.io.IOException;
import java.util.NoSuchElementException;

/**
 * @Author: tjc
 * @description
 * @Date Created in 21:00 2022-08-04
 */
public interface ObjectPool<T> extends Closeable {
    T borrowObject() throws Exception, NoSuchElementException, IllegalStateException;

    void returnObject(T obj) throws Exception;

    void invalidateObject(T obj) throws Exception;

    void clear() throws UnsupportedOperationException;

    int getNumActive();

    int getNumIdle();

    @Override
    void close() throws IOException;
}
